package com.doit.day01;

import redis.clients.jedis.Jedis;

import java.util.UUID;

//生产任务的代码
public class ProducerDemo {
    public static void main(String[] args) throws InterruptedException {

        //key    value   producer     value list task 丢到redis里面去  lpush
        Jedis jedis = new Jedis("linux01", 6379);

        while (true){
            UUID task_id = UUID.randomUUID();
            System.out.println("高收入的37期程序员大佬们开始生产有bug的代码了"+task_id);
            jedis.lpush("producer",task_id.toString());
            //每次生产一个代码休息2s
            Thread.sleep(2000);
            if (jedis.llen("producer") >= 10 ){
                Thread.sleep(10000);
            }
        }
    }

}
